using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace csharpWeb
{

	/// <summary>

	/// Summary description for WebForm1.

	/// </summary>

	public class EmployeeInfo : System.Web.UI.Page

	{

		protected System.Web.UI.WebControls.Label lblEmployeeId;
		protected System.Web.UI.WebControls.TextBox EmployeeId;
		protected System.Web.UI.WebControls.Label lblEmployeeType;
		protected System.Web.UI.WebControls.TextBox EmployeeType;
		protected System.Web.UI.WebControls.Label lblFName;
		protected System.Web.UI.WebControls.TextBox FName;
		protected System.Web.UI.WebControls.Label lblLName;
		protected System.Web.UI.WebControls.TextBox LName;
		protected System.Web.UI.WebControls.Label lblMobilePhone;
		protected System.Web.UI.WebControls.TextBox MobilePhone;
		protected System.Web.UI.WebControls.Label lblHomePhone;
		protected System.Web.UI.WebControls.TextBox HomePhone;
		protected System.Web.UI.WebControls.Label lblOfficePhone;
		protected System.Web.UI.WebControls.TextBox OfficePhone;
		protected System.Web.UI.WebControls.Label lblEmail;
		protected System.Web.UI.WebControls.TextBox Email;
		protected System.Web.UI.WebControls.Label lblAddress1;
		protected System.Web.UI.WebControls.TextBox Address1;
		protected System.Web.UI.WebControls.Label lblAddress2;
		protected System.Web.UI.WebControls.TextBox Address2;
		protected System.Web.UI.WebControls.Label lblCity;
		protected System.Web.UI.WebControls.TextBox City;
		protected System.Web.UI.WebControls.Label lblState;
		protected System.Web.UI.WebControls.TextBox State;
		protected System.Web.UI.WebControls.Label lblZipCode;
		protected System.Web.UI.WebControls.TextBox ZipCode;
		protected System.Web.UI.WebControls.Button cmdExit;
		protected System.Web.UI.WebControls.Button cmdCancel;
		protected System.Web.UI.WebControls.Button cmdSave;

        protected void Page_Load(object sender, EventArgs e)
        {
             string ID;
 
             if(!IsPostBack)
             {
                 //ID = Request.Form("ID");
                 ID = "1";
 
                 EmployeeInfo objData = new EmployeeInfo();
                 EmployeeInfo_DataLoader objDataLoader = new EmployeeInfo_DataLoader();
 
                 try
                 {
 
                     objData = objDataLoader.Get_EmployeeInfo_DATA(ID);
 
                EmployeeId.Text = Convert.ToString(objData.EmployeeId);
                EmployeeType.Text = Convert.ToString(objData.EmployeeType);
                FName.Text = Convert.ToString(objData.FName);
                LName.Text = Convert.ToString(objData.LName);
                MobilePhone.Text = Convert.ToString(objData.MobilePhone);
                HomePhone.Text = Convert.ToString(objData.HomePhone);
                OfficePhone.Text = Convert.ToString(objData.OfficePhone);
                Email.Text = Convert.ToString(objData.Email);
                Address1.Text = Convert.ToString(objData.Address1);
                Address2.Text = Convert.ToString(objData.Address2);
                City.Text = Convert.ToString(objData.City);
                State.Text = Convert.ToString(objData.State);
                ZipCode.Text = Convert.ToString(objData.ZipCode);
                 }
                 catch (Exception ex)
                 {
 
                 }
                 finally
                 {
                     objData.Dispose();
                     objDataLoader.Dispose();
 
                 }
             }
         }
        protected void cmdSave_Click(object sender, EventArgs e)
        {
            bool result;
            EmployeeInfo objData = new EmployeeInfo();
            EmployeeInfo_Mapper objMapper = new EmployeeInfo_Mapper();
 
            try
            {
                objData.EmployeeId = Convert.ToString(EmployeeId.Text);
                objData.EmployeeType = Convert.ToString(EmployeeType.Text);
                objData.FName = Convert.ToString(FName.Text);
                objData.LName = Convert.ToString(LName.Text);
                objData.MobilePhone = Convert.ToString(MobilePhone.Text);
                objData.HomePhone = Convert.ToString(HomePhone.Text);
                objData.OfficePhone = Convert.ToString(OfficePhone.Text);
                objData.Email = Convert.ToString(Email.Text);
                objData.Address1 = Convert.ToString(Address1.Text);
                objData.Address2 = Convert.ToString(Address2.Text);
                objData.City = Convert.ToString(City.Text);
                objData.State = Convert.ToString(State.Text);
                objData.ZipCode = Convert.ToString(ZipCode.Text);
 
                result = objMapper.Load_EmployeeInfo_DATA(objData.ID, objData);
            }
            catch (Exception  ex)
            {
 
            }
            finally
            {
                objData.Dispose();
                objMapper.Dispose();

            }
        }
		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);
		}
		#endregion
	}

}

